﻿@inherits System.Web.Mvc.WebViewPage<Pikapika.Models.ViewModels.Home.IndexModel>

@{
    ViewBag.TitleFormat = "PikaPika 轻小说吐槽计划 {1}";
    ViewBag.BodyClassName = "mobile-flow-sidebar";
    int thumbnailWidth = 80, thumbnailHeight = 110;
}

<div id="google-search-result" style="display: none;">
    <h2 class="main-title">搜索结果</h2>
    <div class="loading-icon"></div>
    <div id="cse"></div>
    <div id="result-container"></div>
    <div class="gsc-branding"><span class="gsc-branding-text">powered by </span><img src="http://www.google.com/uds/css/small-logo.png" class="gsc-branding-img"/></div>
</div>

<h2 class="main-title">最近更新</h2>

<ul id="latest-novels">@foreach (var item in Model.LatestNovels) {<text><li>
                <a class="latest-novel-image" href='@Url.UrlForModel(item.Novel)'>
                    @if (String.IsNullOrWhiteSpace(item.Novel.ImageUrl)) {
                        <span class="novel-image-placeholder"></span>
                    } else {
                        @Html.ThumbnailImage(item.Novel.ImageUrl, thumbnailWidth, thumbnailHeight)
                    }
                </a>
                @Html.ActionLinkForModel(item.Novel, 
                                item.Novel.Name,
                                new RouteValueDictionary 
                                    { {"class", "latest-novel-name-link"},
                                      {"title", item.Novel.Name}
                                })
            
                @Html.ActionLinkForModel(item.LatestChapter, 
                                String.Format("{0} - {1}", item.LatestVolume.Name, item.LatestChapter.Name),
                                new RouteValueDictionary
                                    { {"class", "latest-novel-chapter-link"},
                                      {"title", String.Format("{0} - {1}", item.LatestVolume.Name, item.LatestChapter.Name)}
                                })
            </li></text>}</ul>

<div class="clear"></div>

<h2>大家在吐槽...</h2>

<ul id="latest-annotations">
    @foreach (var ann in Model.LatestAnnotations) { 
        <li>
            <div class="annotation-content">@ann.AnnotationContent</div>
            <div class="annotation-novel">
                --
                @Html.ActionLinkForModel(ann.NovelChapter.NovelVolume.Novel, 
                                ann.NovelChapter.NovelVolume.Novel.Name)
                -
                @Html.ActionLinkForModel(ann.NovelChapter,
                                String.Format("{0} - {1}", ann.NovelChapter.NovelVolume.Name, ann.NovelChapter.Name))
            </div>
        </li>
    }
</ul>

<div class="clear"></div>

@section Sidebar {
    <h2 class="ranking-title">搜索小说</h2>
    <div id="google-search">
        <div id="cse-search-form">
            <!-- fallback for browsers without javascript -->
            <form class="gsc-search-box" accept-charset="utf-8"  action="http://www.google.com/cse">
                <input type="hidden" name="cx" value="004444445504374248743:pn98cdeq3ys" />
                <input type="hidden" name="ie" value="UTF-8" />
                <span class="gsc-input">
                    <input type="text" autocomplete="off" size="10" class="gsc-input" name="q" title="搜索" style="background: url(&quot;http://www.google.com/coop/intl/zh-CN/images/google_custom_search_watermark.gif&quot;) no-repeat scroll left center rgb(255, 255, 255); width: 197px; margin: 5px 2px 5px 5px">
                </span>
                <span class="gsc-search-button">
                    <input type="submit" value="搜索" class="gsc-search-button" name="sa" title="搜索" style="margin: 5px 0">
                </span>
            </form>
        </div>
    </div>

    <h2 class="ranking-title">一周点击排行</h2>

    <ul class="ranking">
        @foreach (var item in Model.WeeklyHottestNovels) {
            <li>
                @Html.ActionLinkForModel(item.Novel,
                                         item.Novel.Name,
                                         new RouteValueDictionary { {"class", "ranking-novel-name-link"} })
                <span>点击： @item.HitCount</span>
            </li>
        }
    </ul>

    <h2 class="ranking-title">友情链接</h2>

    <ul class="ranking">
        <li>
            <a href="http://bilibili.us/">BiliBili</a>
        </li>
        <li>
            <a href="http://www.acfun.cn/">Acfun 天下漫友是一家</a>
        </li>
    </ul>
    <script src="http://www.google.com/jsapi?key=ABQIAAAAQaiUI5mOlEZX2E44tSKzIxQtp31_LefCXY4LLN3XxdKUdLgLqBTVLnD2PMmvPTUJsAZh2ghya2QlXQ" type="text/javascript"></script>
    @Html.Script("Home/Index.js?20101104")
}



@section Head {
    @Html.Script(StandardLibraries.Jquery)
    @Html.Css("google-search.css")
    @Html.Css("Home/Index.css?20101129")
    <link href="@Url.Action("LatestNovels", "Feed")" type="application/atom+xml" rel="alternate" title="最近更新" />
}
